package com.vercon.commonmirror.view;


import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.TextView;

import skin.support.widget.SkinCompatTextView;

/**
 * Created by yzc on 2018-10-30.
 * 默认中文适用
 *
 * 不要再用了
 */

@SuppressLint("AppCompatCustomView")
public class NormalTextView extends SkinCompatTextView {

    public NormalTextView(Context context) {
        super(context);
        initTypeFace(context);
    }

    public NormalTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initTypeFace(context);
    }

    public NormalTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initTypeFace(context);
    }

    private void initTypeFace(Context context) {
        if (isInEditMode()) {
            if (getText().toString().trim().equals(""))
                setText("XXX");
        }
        setTypeface(FontProvider.getInstance(getContext()).getTypeface(FontProvider.chinese_type));
//        setTypeface(TypefaceUtil.createTypeface(context, FontProvider.chinese_type));
     }

    @Override
    public boolean isFocused() {
        return true;
    }

    @Override
    public void setTextAppearance(Context context, int resId) {
        super.setTextAppearance(context, resId);
        setTypeface(FontProvider.getInstance(getContext()).getTypeface(FontProvider.chinese_type));
    }

}
